<template>
  <el-table :data="data" style="width: 100%">
    <el-table-column prop="orderNum" label="编号" width="130"></el-table-column>
    <el-table-column prop="orderTitle" label="标题" width="200"></el-table-column>
    <el-table-column prop="orderType" label="类型" width="100"></el-table-column>
    <el-table-column prop="orderLeader" label="负责人" width="100"></el-table-column>
    <el-table-column prop="orderStatus" label="状态" width="100"></el-table-column>
    <el-table-column prop="deviceType" label="相关设备" width="120"></el-table-column>
    <el-table-column label="创建时间" width="160">
      <template #default="scope">
        {{ formatTime(scope.row.createTime) }}
      </template>
    </el-table-column>
    <el-table-column label="更新时间" width="160">
      <template #default="scope">
        {{ formatTime(scope.row.updateTime) }}
      </template>
    </el-table-column>
    <el-table-column label="详细信息" width="120">
      <template #default="scope">
        <el-button type="text" @click="viewDetails(scope.row)">详细信息</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  props: {
    data: {
      type: Array,
      required: true
    }
  },
  methods: {
    viewDetails(row) {
      console.log('查看工单详情:', row);
      // 这里可以添加查看工单详情的逻辑
    },
    formatTime(timeString) {
      // 截取时间字符串，只保留到分钟
      return timeString.substring(0, 16);
    }
  }
  
}
</script>